package top.zxybird.yun.serialization.thrift.model;

import java.util.List;
import java.util.stream.Collectors;

import com.google.common.collect.Lists;

import lombok.EqualsAndHashCode;
import lombok.ToString;

@EqualsAndHashCode(callSuper = true)
@ToString(includeFieldNames = true)
public class TStruct extends TType {

  private List<Object> value;

  public void addField(TType field) {
    value.add(field);
  }

  public List<TType> getAllField() {
    return value.stream().map(x -> (TType) x).collect(Collectors.toList());
  }

  public Object getValue() {
    return value;
  }

  public TStruct() {
    this.setType(TTypeConstant.STRUCT);
    this.value = Lists.newArrayList();
  }

}
